home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / Bowers Development / AppMaker 2.0b5 / Examples / TCL / AMReminder / MainWindow.cp < prev    next >
Text File  |  1996-03-19  |  3KB  |  161 lines

  1. /* MainWindow.cp -- window methods */
  2. /* Created 01/01/95 12:01 PM by AppMaker */
  3.  
  4. /*    This module overrides the AppMaker-generated code in zMainWindow.        */
  5. /*    It provides a place for you to add your own code and still be able to    */
  6. /*    generate code for new changes to the user interface.  This module will    */
  7. /*    not be regenerated by AppMaker unless you delete it.  Its superclass,    */
  8. /*    zMainWindow, may be regenerated to handle user interface changes        */
  9. /*    without losing your hand-coded changes to this module.                    */
  10.  
  11. #include <Commands.h>
  12. #include <CBartender.h>
  13. #include <CDecorator.h>
  14. #include <CDirector.h>
  15. #include <TBUtilities.h>
  16. #include <CPicture.h>
  17. #include <CAMStaticText.h>
  18. #include <CAMBorder.h>
  19. #include <CScrollPane.h>
  20. #include <CAMArrayPane.h>
  21. #include <CAMButton.h>
  22. #include "CmdCodes.h"
  23. #include "Add.h"
  24. #include "Add.h"
  25. #include "AMReminderData.h"
  26. #include "MainWindow.h"
  27.  
  28. extern    CBartender        *gBartender;    /* The menu handling object */
  29. extern    CDecorator        *gDecorator;    /* Window dressing object */
  30.  
  31.  
  32. /*----------*/
  33. void    CMainWindow::IMainWindow    (CDirector            *aSupervisor,
  34.                                      CAMReminderData    *theData)
  35. {
  36.     itsData = theData;
  37.     inherited::IZMainWindow (aSupervisor);
  38.     gDecorator->StaggerWindow (this);
  39.  
  40.     // any additional initialization for your window
  41.  
  42. } /* IMainWindow */
  43.  
  44. /*----------*/
  45. void    CReminders::IViewTemp    (CView            *anEnclosure,
  46.                              CBureaucrat    *aSupervisor,
  47.                              Ptr            viewData)
  48. {
  49.     inherited::IViewTemp (anEnclosure, aSupervisor, viewData);
  50.  
  51.     // any additional initialization for your subclass
  52.     AddRow (4, 0);        // e.g., add 4 rows at the beginning of the list
  53.  
  54. } /* IViewTemp */
  55.  
  56. /*----------*/
  57. void    CReminders::GetCellText    (Cell            aCell,
  58.                                  short            availableWidth,
  59.                                  StringPtr        itsText)
  60. {
  61.     // replace with your own code which uses the cell coordinates
  62.     // to access your private data structures,
  63.     // then convert the cell data to a Str255
  64.  
  65.     switch (aCell.v) {
  66.         case 0:
  67.                 CopyPString ("\pOne", itsText);
  68.             break;
  69.         case 1:
  70.                 CopyPString ("\pTwo", itsText);
  71.             break;
  72.         case 2:
  73.                 CopyPString ("\pThree", itsText);
  74.             break;
  75.         default:
  76.                 CopyPString ("\pInfinity", itsText);
  77.             break;
  78.     }; /* switch */
  79.  
  80. } /* GetCellText */
  81.  
  82. /*----------*/
  83. // This overrides the parent's NewReminders to create a subclass of CAMArrayPane
  84.  
  85. CAMArrayPane    *CMainWindow::NewReminders    (void)
  86. {
  87.     CReminders            *theList;
  88.  
  89.     theList = new CReminders;
  90.  
  91.     return (theList);
  92.  
  93. } /* NewReminders */
  94.  
  95. /*----------*/
  96. void    CMainWindow::UpdateMenus    (void)
  97. {
  98.     inherited::UpdateMenus ();
  99.  
  100.     gBartender->EnableCmd (cmdAddReminder);
  101.     gBartender->EnableCmd (cmdEditReminder);
  102.     gBartender->EnableCmd (cmdDeleteReminder);
  103.  
  104. } /* UpdateMenus */
  105.  
  106. /*----------*/
  107. void    CMainWindow::DoCommand        (long        theCommand)
  108. {
  109.     switch (theCommand) {
  110.  
  111.     case cmdAddReminder:
  112.         DoAddReminder ();
  113.         break;
  114.  
  115.     case cmdEditReminder:
  116.         DoEditReminder ();
  117.         break;
  118.  
  119.     case cmdDeleteReminder:
  120.         DoDeleteReminder ();
  121.         break;
  122.  
  123.     default:
  124.         inherited::DoCommand (theCommand);
  125.         break;
  126.     } /* switch */
  127.  
  128. } /* DoCommand */
  129.  
  130. //----------
  131. void    CMainWindow::DoAddReminder ()
  132. {
  133. }
  134.  
  135. //----------
  136. void    CMainWindow::DoEditReminder ()
  137. {
  138. }
  139.  
  140. //----------
  141. void    CMainWindow::DoDeleteReminder ()
  142. {
  143. }
  144.  
  145. /*----------*/
  146. void    CMainWindow::ProviderChanged    (CCollaborator    *aProvider,
  147.                                          long            reason,
  148.                                          void*            info)
  149. {
  150.     if (aProvider == itsReminders) {
  151.         if (itsReminders->HasSelection ()) {
  152.             // perhaps activate some buttons
  153.         } else {
  154.             // perhaps deactivate
  155.         }
  156.     }
  157.  
  158. } /* ProviderChanged */
  159.  
  160. /* MainWindow.cp */
  161.